package com.xbongbong.saas.enums.business;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.enums.ScreenTypeEnum;
import com.xbongbong.saas.enums.SetTypeEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import com.xbongbong.saas.enums.base.ManagementBaseEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * 经销商枚举
 * @author xinpeng.jiang
 * @date 2020/12/18 17:02
 * @version 1.0
 * @since V1.0
 */
@Getter
public enum DistributorEnum {
    /**
     * 基础信息
     * other_1
     */
    BASE_INFO(ManagementBaseEnum.BASE_INFO.getAttr(), "enum.distributor.attrName.base_info", "baseInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 10000, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 经销商名称
     * text_1
     */
    NAME(ManagementBaseEnum.NAME.getAttr(), "enum.distributor.attrName.name", "name", FieldTypeEnum.TEXT.getType(), SetTypeEnum.DISABLE_ALL.getCode(), 0, 0, ShowTypeEnum.ALL.getCode(), 9990, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 经销商简称
     * text_2
     */
    NAME_SHORT(ManagementBaseEnum.NAME_SHORT.getAttr(), "enum.distributor.attrName.name_short", "nameShort", FieldTypeEnum.TEXT.getType(), SetTypeEnum.DISABLE_NONE.getCode(), 0, 0, ShowTypeEnum.ALL.getCode(), 9980, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 所在地区
     */
    AREA("text_4", "enum.distributor.attrName.area", "area", FieldTypeEnum.AREA.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9970, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 经销商级别
     * text_6
     */
    SCALE(ManagementBaseEnum.SCALE.getAttr(), "enum.distributor.attrName.scale", "scale", FieldTypeEnum.COMBO.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9960, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 联系电话
     * subForm_1
     */
    PHONE(ManagementBaseEnum.PHONE.getAttr(), "enum.distributor.attrName.phone", "phone", FieldTypeEnum.CONTACT_NUMBER.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9950, 1, 1, ScreenTypeEnum.SCREEN_SEARCH.getType()),
    /**
     * 经销商地址
     * address_1
     */
    ADDRESS(ManagementBaseEnum.ADDRESS.getAttr(), "enum.distributor.attrName.address", "address", FieldTypeEnum.ADDRESS.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9940, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 收货地址
     */
    SHIPPING_ADDRESS("subForm_2", "enum.distributor.attrName.shipping_address", "shippingAddress", FieldTypeEnum.SUB_FORM.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9930, 1, 0, ScreenTypeEnum.SCREEN_SEARCH.getType()),
    /**
     * 负责人
     * ownerId
     */
    OWNER_ID(ManagementBaseEnum.OWNER_ID.getAttr(), "enum.distributor.attrName.owner_id", "ownerId", FieldTypeEnum.OWNERID.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9920, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 协同人
     * coUserId
     */
    COUSERID(ManagementBaseEnum.COUSERID.getAttr(), "enum.distributor.attrName.couserid", "coUserId", FieldTypeEnum.COUSERID.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9910, 1, 0, ScreenTypeEnum.SCREEN_SEARCH.getType()),
    /**
     * 结算方式
     */
    SETTLEMENT_METHOD("array_2", "enum.distributor.attrName.settlement_method", "settlementMethod", FieldTypeEnum.CHECKBOX_GROUP.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9900, 1, 0, ScreenTypeEnum.SCREEN_SEARCH.getType()),
    /**
     * 信用额度支付
     */
    PAYMENT_BY_CREDIT("text_21", "enum.distributor.attrName.payment_by_credit", "paymentByCredit", FieldTypeEnum.RADIO_GROUP.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9890, 1, 1, ScreenTypeEnum.SCREEN_SEARCH.getType()),

    /**
     * 关联信息
     * other_2
     */
    ASSOCIATED_INFO(ManagementBaseEnum.ASSOCIATED_INFO.getAttr(), "enum.distributor.attrName.associated_info", "associatedInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.ALL.getCode(), 9880, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 添加经销商联系人
     * array_1
     */
    ADD_CONTACT(ManagementBaseEnum.ADD_CONTACT.getAttr(), "enum.distributor.attrName.add_contact", "addContact", FieldTypeEnum.LINK_FORM.getType(), 3, 1, 0, ShowTypeEnum.EDIT.getCode(), 9870, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),

    /**
     * 扩展信息
     * other_3
     */
    EXTEND_INFO(ManagementBaseEnum.EXTEND_INFO.getAttr(), "enum.distributor.attrName.extend_info", "extendInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.ALL.getCode(), 9860, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 经销商来源
     * text_9
     */
    SOURCE(ManagementBaseEnum.SOURCE.getAttr(), "enum.distributor.attrName.source", "source", FieldTypeEnum.COMBO.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9850, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 经销商信用
     */
    CREDIT("text_3", "enum.distributor.attrName.credit", "credit", FieldTypeEnum.COMBO.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9840, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 财务状况
     */
    FINANCIAL_SITUATION("text_5", "enum.distributor.attrName.financial_situation", "financialSituation", FieldTypeEnum.COMBO.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9830, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 销售能力
     */
    MARKETABILITY("text_7", "enum.distributor.attrName.marketability", "marketability", FieldTypeEnum.COMBO.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9820, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 经营状况
     */
    OPERATING_CONDITIONS("text_8", "enum.distributor.attrName.operating_conditions", "operatingConditions", FieldTypeEnum.COMBO.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9810, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 管理能力
     */
    MANAGEMENT_ABILITY("text_10", "enum.distributor.attrName.management_ability", "managementAbility", FieldTypeEnum.COMBO.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9800, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 经营规模
     */
    BUSINESS_SCALE("text_11", "enum.distributor.attrName.business_scale", "businessScale", FieldTypeEnum.COMBO.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9790, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 可采购商品
     */
    PURCHASEABLE_GOODS("array_3", "enum.distributor.attrName.purchaseable_goods", "purchaseableGoods", FieldTypeEnum.PURCHASEABLE_GOODS.getType(), 3, 0, 0, ShowTypeEnum.ALL.getCode(), 9780, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),

    /**
     * 系统信息
     * other_4
     */
    SYSTEM_INFO(ManagementBaseEnum.SYSTEM_INFO.getAttr(), "enum.distributor.attrName.system_info", "systemInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 9770, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 创建时间
     * addTime
     */
    ADD_TIME(ManagementBaseEnum.ADD_TIME.getAttr(), "enum.distributor.attrName.add_time", "addTime", FieldTypeEnum.ADDTIME.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9750, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 更新时间
     * updateTime
     */
    UPDATE_TIME(ManagementBaseEnum.UPDATE_TIME.getAttr(), "enum.distributor.attrName.update_time", "updateTime", FieldTypeEnum.UPDATETIME.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9740, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),

    // 不在模板设置界面展示字段，但需要在列表详情展示
    /**
     * 最后跟进时间
     * date_2
     */
    LAST_CONNECT_TIME(ManagementBaseEnum.LAST_CONNECT_TIME.getAttr(), "enum.distributor.attrName.last_connect_time", "lastConnectTime", FieldTypeEnum.DATETIME.getType(), 1, 1, 0, ShowTypeEnum.LIST_DETAIL.getCode(), 9630, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 分配时间
     * date_4
     */
    // DISTRIBUTION_DATE(ManagementBaseEnum.DISTRIBUTION_DATE.getAttr(), "enum.distributor.attrName.distribution_date", "distributionDate", FieldTypeEnum.DATETIME.getType(), 1, 1, 1, ShowTypeEnum.LIST.getCode(), 9610, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),

    // 逻辑字段
    /**
     * 逻辑创建人
     * creatorId
     */
    CREATOR_ID(ManagementBaseEnum.CREATOR_ID.getAttr(), "enum.distributor.attrName.creator_id", "creatorId", FieldTypeEnum.CREATORID.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9600, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 关联生日隐藏
     * num_2
     */
    BIRTHDAY_FLAG(ManagementBaseEnum.BIRTHDAY_FLAG.getAttr(), "enum.distributor.attrName.birthday_flag", "birthdayFlag", FieldTypeEnum.NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9590, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 月日生日
     * text_15
     */
    BIRTHDAY_MMDD(ManagementBaseEnum.BIRTHDAY_MMDD.getAttr(), "enum.distributor.attrName.birthday_mmdd", "birthdayMmdd", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9580, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 是否公海
     * num_3
     */
    IS_PUBLIC(ManagementBaseEnum.IS_PUBLIC.getAttr(), "enum.distributor.attrName.is_public", "isPublic", FieldTypeEnum.COMBO_NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9570, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 是否归档
     * num_4
     */
    IS_ARCHIVED(ManagementBaseEnum.IS_ARCHIVED.getAttr(), "enum.distributor.attrName.is_archived", "isArchived", FieldTypeEnum.COMBO_NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9560, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    /**
     * 钉钉客户id
     * text_14
     */
    DD_CUSTOMER_ID(ManagementBaseEnum.DD_CUSTOMER_ID.getAttr(), "enum.distributor.attrName.dd_customer_id", "ddCustomerId", FieldTypeEnum.TEXT.getType(), 1, 1, 1, ShowTypeEnum.NONE.getCode(), 9550, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 上级客户隐藏
     * text_20
     */
    PARENT_HIDE(ManagementBaseEnum.PARENT_HIDE.getAttr(), "enum.distributor.attrName.parent_hide", "parentHide", FieldTypeEnum.TEXT.getType(), 3, 0, 1, ShowTypeEnum.NONE.getCode(), 9540, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * 栗子公司ID
     * text_66
     */
    CLUE_COMPANY_ID(ManagementBaseEnum.CLUE_COMPANY_ID.getAttr(), "enum.distributor.attrName.clue_company_id", "clueCompanyID", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9530, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    /**
     * text_81：应收账期
     */
    RECEIVABLE_PERIOD(ManagementBaseEnum.RECEIVABLE_PERIOD.getAttr(), "enum.distributor.attrName.receivable_period", "receivablePeriod", FieldTypeEnum.ACCOUNT_PERIOD.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9520, 1, 1, ScreenTypeEnum.SCREEN_SHOW.getType())
    ;
    /**
     * 英文名称
     */
    private String attr;
    /**
     * 中文名称
     */
    private String attrName;
    /**
     * 对应saas中的attr
     */
    private String saasAttr;
    /**
     * 字段类型，详见
     *
     * @see FieldTypeEnum
     */
    private Integer fieldType;
    /**
     * 重命名、判重、启用必填等权限
     * 1.重命名+字段权限
     * 2.重命名+字段权限+查重
     * 3.重命名+字段权限+启用、必填
     * 4.重命名+字段权限+查重+启用、必填
     * 注：pro中启用和必填是同一个权限，同时启用或同时关闭
     */
    private Integer setType;
    /**
     * 模板设计阶段字段是否允许编辑
     * 1：允许编辑
     * 0：不允许编辑
     */
    private Integer designEditable;
    /**
     * 字段是否显示在模板设计界面
     * 1：不显示
     * 0：显示
     */
    private Integer editHide;
    /**
     * 字段在各个界面（新建、编辑、列表、详情）的展现形式
     * 详见
     *
     * @see ShowTypeEnum
     */
    private Integer showType;
    /**
     * 字段在模板设计界面的排序
     * 建议不要用连续的数字，可以用等差数列，以防以后在两个字段之间加入新字段
     */
    private Integer sort;
    /**
     * 字段在各个界面是否可见(启用)
     * 1：可见
     * 0：不可见
     * 注：字段在具体页面的可见性需要用属性和showType联合判断，在visible=1的情况下判断showType
     */
    private Integer visible;
    /**
     * 字段是否必填
     * 1：必填
     * 0：不必填
     */
    private Integer required;
    /**
     * 筛选类型
     * 1：可筛选
     * 2：不可筛选
     */
    private Integer screenType;

    DistributorEnum(String attr, String attrName, String saasAttr, Integer fieldType, Integer setType, Integer designEditable,
                    Integer editHide, Integer showType, Integer sort, Integer visible, Integer required, Integer screenType) {
        this.attr = attr;
        this.attrName = attrName;
        this.saasAttr = saasAttr;
        this.fieldType = fieldType;
        this.setType = setType;
        this.designEditable = designEditable;
        this.editHide = editHide;
        this.showType = showType;
        this.sort = sort;
        this.visible = visible;
        this.required = required;
        this.screenType = screenType;
    }

    /**
     * 对data内的字段拼上“data.”
     *
     * @param cache
     * @return java.lang.String
     * @author zcp
     * @date 2019/3/1 18:12
     * @version v1.0
     * @since v1.0
     */
    public static String getAttrConnectData(DistributorEnum cache) {
        return "data." + cache.getAttr();
    }

    /**
     * 获取es查询、聚合字段
     * data在库内是json对象，对data字段内某个key做es【精确查询】时，需要在其前拼上“data.”，且【text等类型的】要在后面拼“.keyword”
     *
     * @param cache 当前枚举对象
     * @return java.lang.String 处理后的聚合字段
     * @author zcp
     * @date 2019/2/21 14:59
     * @version v1.0
     * @since v1.0
     */
    public static String getEsAttr4Keyword(DistributorEnum cache) {
        FieldTypeEnum fieldTypeEnum = FieldTypeEnum.getFieldTypeEnum(cache.fieldType);
        //字段类型为text，或者字段在es内的类型时text，则需要在后面拼上“.keyword”
        boolean flag = fieldTypeEnum == FieldTypeEnum.TEXT || "text".equals(fieldTypeEnum.getEsalias());
        if (flag) {
            return "data." + cache.getAttr() + ".keyword";
        }
        return "data." + cache.getAttr();
    }

    // /**
    //  * 根据指标规则枚举获取出数据字典相应字段（主要是客户行业、来源、状态等）
    //  *
    //  * @param indicatorRuleEnum 指标规则枚举
    //  * @return com.xbongbong.saas.enums.dictionary.DictionaryEnum
    //  * @author zcp
    //  * @date 2019/5/1 17:26
    //  * @version v1.0
    //  * @since v1.0
    //  */
    // public static String getEsAttrByIndicatorRuleEnum(IndicatorRuleEnum indicatorRuleEnum) {
    //     if (IndicatorRuleEnum.CUSTOMER_INDUSTRY == indicatorRuleEnum) {
    //         return getEsAttr4Keyword(INDUSTRY);
    //     } else if (IndicatorRuleEnum.CUSTOMER_SOURCE == indicatorRuleEnum) {
    //         return getEsAttr4Keyword(SOURCE);
    //     } else if (IndicatorRuleEnum.CUSTOMER_TYPE == indicatorRuleEnum) {
    //         return getEsAttr4Keyword(TYPE);
    //     }
    //     return "";
    // }

    /**
     * 拼接地址字段
     * 库内地址字段的格式为：data对象—address对象—{"province": "", "district":"", "city":"", "address": ""}
     *
     * @param addressEnum
     * @param key         类型，此处传"province"、"district"、"city"
     * @return java.lang.String 处理后的es地址聚合字段
     * @author zcp
     * @date 2019/2/25 14:50
     * @version v1.0
     * @since v1.0
     */
    public static String getAddress4Aggs(DistributorEnum addressEnum, String key) {
        String province = "province";
        String district = "district";
        String city = "city";
        String attr = "data." + addressEnum.getAttr() + ".";
        if (province.equals(key)) {
            return attr + province + ".keyword";
        } else if (district.equals(key)) {
            return attr + district + ".keyword";
        } else if (city.equals(key)) {
            return attr + city + ".keyword";
        }
        return attr + "keyword";
    }

    // public static List<JSONObject> getCheckRepeatHead() {
    //     JSONObject customerName = new JSONObject();
    //     customerName.put("prop", "name");
    //     customerName.put("fieldType", NAME.fieldType);
    //     customerName.put("label", NAME.getAttrName());
    //     JSONObject mainUser = new JSONObject();
    //     mainUser.put("prop", "mainUser");
    //     mainUser.put("fieldType", OWNER_ID.fieldType);
    //     mainUser.put("label", OWNER_ID.getAttrName());
    //     JSONObject addTime = new JSONObject();
    //     addTime.put("prop", "addTime");
    //     addTime.put("fieldType", ADD_TIME.fieldType);
    //     addTime.put("label", ADD_TIME.getAttrName());
    //     JSONObject customerStatus = new JSONObject();
    //     customerStatus.put("prop", "customerStatus");
    //     customerStatus.put("fieldType", TYPE.fieldType);
    //     customerStatus.put("label", TYPE.getAttrName());
    //     JSONObject position = new JSONObject();
    //     position.put("prop", "position");
    //     position.put("fieldType", FieldTypeEnum.TEXT.getType());
    //     position.put("label", I18nMessageUtil.getMessage(I18nStringConstant.LOCATION));
    //     JSONObject formName = new JSONObject();
    //     formName.put("prop", "formName");
    //     formName.put("fieldType", FieldTypeEnum.TEXT.getType());
    //     formName.put("label", I18nMessageUtil.getMessage(I18nStringConstant.FORM_NAME));
    //     JSONObject isArchived = new JSONObject();
    //     isArchived.put("prop", "isArchived");
    //     isArchived.put("fieldType", IS_ARCHIVED.fieldType);
    //     isArchived.put("label", IS_ARCHIVED.getAttrName());
    //     JSONObject option = new JSONObject();
    //     option.put("prop", "option");
    //     option.put("fieldType", FieldTypeEnum.OPTION.getType());
    //     option.put("label", I18nMessageUtil.getMessage(CommonConstant.OPERATE));
    //     return Arrays.asList(customerName, mainUser, addTime, customerStatus, position, formName, isArchived, option);
    // }

    /**
     * app端详情默认标签显示字段
     *
     * @return List
     * @author GuoJun.HU
     * @date 2019/4/8 19:21
     * @since V1.0
     */
    public static List<Object> getLabelAttrList() {
        return Arrays.asList(SCALE, SOURCE, BUSINESS_SCALE);
    }

    /**
     * app端详情默认摘要
     *
     * @author GuoJun.HU
     * @since V1.0
     * @return List
     * @date 2019/4/8 19:21
     */
    public static List<Object> getSummaryAttrList() {
        return Arrays.asList(OWNER_ID, SCALE, AREA, LAST_CONNECT_TIME);
    }

    /**
     * app端详情默认标题显示字段
     *
     * @return List
     * @author GuoJun.HU
     * @date 2019/4/8 19:21
     * @since V1.0
     */
    public static List<Object> getTitleAttrList() {
        return Collections.singletonList(NAME);
    }

    /**
     * app端详情默认标签显示字段
     * @return List
     * @author xingxing.xiao
     */
    public static List<Object> getLabelAttrListSimple() {
        return Arrays.asList(SCALE, SOURCE, BUSINESS_SCALE);
    }

    /**
     * app端详情默认摘要
     * @return List
     * @author xingxing.xiao
     */
    public static List<Object> getSummaryAttrSimpleList() {
        return Arrays.asList(OWNER_ID, SCALE, AREA, LAST_CONNECT_TIME);
    }

    /**
     * 流程中获取隐藏字段
     *
     * @return
     */
    public static List<DistributorEnum> getDisableField() {
        List<DistributorEnum> distributorEnums = new ArrayList<>();
        for (DistributorEnum distributorEnum : values()) {
            if (Objects.equals(distributorEnum.getShowType(), ShowTypeEnum.NONE.getCode()) || Objects.equals(distributorEnum.getEditHide(), 1)
                    || Objects.equals(distributorEnum.getFieldType(), FieldTypeEnum.CREATORID.getType()) || Objects.equals(distributorEnum.getFieldType(), FieldTypeEnum.ADDTIME.getType())) {
                distributorEnums.add(distributorEnum);
            }
        }
        return distributorEnums;
    }

    // /**
    //  * 把传入的字段（类型为LINK_BUSINESS_SINGLE）的转为其隐藏字段
    //  * @param attr 字段名
    //  * @return java.lang.String
    //  * @author zcp
    //  * @date 2019/7/4 15:31
    //  * @since v1.0
    //  * @version v1.0
    //  */
    // public static String changeToHide4Link(String attr) {
    //     if (Objects.equals(attr, PARENT.attr)) {
    //         return PARENT_HIDE.attr;
    //     }
    //     return attr;
    // }

    /**
     * 获取统计规则的归属人设置相关字段
     * @return
     */
    public static List<String> getCustomerBelongAttrs() {
        return Arrays.asList(DistributorEnum.CREATOR_ID.getAttr(), DistributorEnum.OWNER_ID.getAttr(), DistributorEnum.COUSERID.getAttr());
    }

    // /**
    //  * 获取销售漏斗的统计规则的统计时间设置相关字段
    //  * @return
    //  */
    // public static List<String> getCustomerTimeAttrs() {
    //     return Arrays.asList(CustomerDistributorEnum.ADD_TIME.getAttr(), CustomerDistributorEnum.UPDATE_TIME.getAttr(), CustomerDistributorEnum.LAST_CONNECT_TIME.getAttr());
    // }

    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }

    public static String getI18nValue(String value) {
        return I18nMessageUtil.getMessage(value);
    }
}
